﻿<ToastBox class="d-block" Title="保存数据" IsAutoHide="false" Content="保存数据成功，4 秒后自动关闭"></ToastBox>
<ToastBox class="d-block" Category="ToastCategory.Error" Title="保存数据" IsAutoHide="false" Content="保存数据失败，4 秒后自动关闭"></ToastBox>
<ToastBox class="d-block" Category="ToastCategory.Information" Title="提示信息" IsAutoHide="false"  Content="信息提示弹窗，4 秒后自动关闭"></ToastBox>
<Button Color="Color.Success" OnClick="@OnSuccessClick">成功通知</Button>
<Button Color="Color.Danger" OnClick="@OnErrorClick" >失败通知</Button>
<Button Color="Color.Info" OnClick="@OnInfoClick" >信息通知</Button>

@code{
    protected void OnSuccessClick()
    {
        Toast?.SetPlacement(Placement.BottomEnd);
        ToastService?.Show(new ToastOption()
        {
            Category = ToastCategory.Success,
            Title = "保存成功",
            Content = "保存数据成功，4 秒后自动关闭"
        });
    }

    protected void OnErrorClick()
    {
        Toast?.SetPlacement(Placement.BottomEnd);
        ToastService?.Show(new ToastOption()
        {
            Category = ToastCategory.Error,
            Title = "保存失败",
            Content = "保存数据失败，4 秒后自动关闭"
        });
    }

    protected void OnInfoClick()
    {
        Toast?.SetPlacement(Placement.BottomEnd);
        ToastService?.Show(new ToastOption()
        {
            Category = ToastCategory.Information,
            Title = "消息通知",
            Content = "系统增加新组件啦，4 秒后自动关闭"
        });
    }
}
